package com.ssy.lingxi.product.repository.warehouse;

import com.ssy.lingxi.product.entity.warehouse.FreightSpace;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface FreightSpaceRepository extends JpaRepository<FreightSpace, Long> {

    /**
    * 根据商品ID查询仓位库存 有效并且不是会员共享的仓位
    * @author wrc
    * @date 2020/7/9
    */
    List<FreightSpace>  findAllByProductIdInAndStateEqualsAndIsAllMemberShareEquals(List<Long> productIds,Integer state,Integer isAllMemberShare);



    List<FreightSpace>  findAllByProductIdInAndIdIn(List<Long> productIds,List<Long> id);
    /**
     * 根据商品ID查询仓位库存
     * @author wrc
     * @date 2020/7/9
     */
    List<FreightSpace>  findAllByProductIdEqualsAndIdIn(Long productId,List<Long> ids);



    List<FreightSpace>    findAllByProductIdEquals(Long productId);
    List<FreightSpace> findAllByStateEquals(Integer state);
    /**
     * 根据仓库ID查询仓位信息
     * @author wrc
     * @date 2020/7/9
     */
    List<FreightSpace>  findAllByWarehouseIdEquals(Long warehouseId);

    List<FreightSpace>  findAllByProductIdInAndIsAllMemberShareEquals(List<Long> productIds,Integer isAllMemberShare);


    Boolean existsAllByNameEqualsAndMemberIdAndCreateRoleId(String name, Long memberId, Long memberRoleId);


    Boolean existsByIdNotAndNameEquals(Long id,String name);

    List<FreightSpace>  findByProductIdInAndState(List<Long> productIds, Integer state);

    List<FreightSpace> findByState(Integer code);
}
